import {mainEchart} from '../index';


let man = `path://M516.608 217.6c40.448 0 72.704-32.768 72.704-72.704 0-40.448-32.768-72.704-72.704-72.704-40.448 0-72.704 32.768-72.704 72.704s32.256 72.704 72.704 72.704z m80.384 18.432H435.712c-51.2 0-93.696 41.472-93.696 93.184v225.28c0 17.408 13.824 31.744 31.232 31.744s31.744-14.336 31.744-31.744V351.744h16.384v565.76c0 23.552 18.944 42.496 43.008 42.496 23.552 0 42.496-18.944 42.496-42.496V588.8h17.408v328.192c0 23.552 18.944 42.496 42.496 42.496 23.552 0 43.008-18.944 43.008-42.496V351.744h16.384v203.264c0 17.408 14.336 31.744 31.744 31.744 17.408 0 31.232-14.336 31.232-31.744v-225.28c1.024-51.712-40.96-93.696-92.16-93.696z`;
let girl = `path://M693.064905 504.590142l-55.845778-202.954549c-7.532724-22.967796-34.488553-63.372358-79.685923-65.239925h-89.777337c-46.750604 1.927976-73.520086 41.894316-80.000256 65.365863l-55.777177 202.707792c-11.954885 44.266658 39.220951 61.57032 51.857744 19.985218l49.867311-187.020846h14.008799l-85.85176 328.529989h80.247012v246.909946c0 44.697714 60.764522 44.697714 60.764522 0v-246.909946h18.924473v246.909946c0 44.697714 58.766922 44.697714 58.766922 0v-246.909946h82.427888l-87.654823-328.529989h15.938823l49.988129 187.020846c12.331675 42.517862 63.256659 24.280417 51.801431-19.864399zM512.336858 219.833299c38.471467 0 69.538196-32.435663 69.538196-72.527941 0-40.031868-31.066729-72.528965-69.538196-72.528965-38.415154 0-69.48393 32.497096-69.48393 72.528965 0 40.030845 31.0698 72.527941 69.48393 72.527941z`;
export default class newDemandSexRatio extends mainEchart {
    defaultOption = {
        color: ["#29D7A8", "#3C404C"],
        tooltip: {
            show: false,
        },
        grid: {
            top: 0,
            left: 0,
            right: 0,
            bottom: 0,
            containLabel: true,
        },
        xAxis: {
            type: "value",
            max: 1,
            splitLine: {show: false},
            offset: 10,
            axisLine: {
                show: false,
                lineStyle: {
                    color: "#999",
                },
            },
            axisLabel: {
                show: false,
                margin: 10,
            },
        },
        yAxis: {
            type: "category",
            data: ['男'],
            inverse: true,
            axisTick: {show: false},
            axisLine: {show: false},
            axisLabel: {
                show: false,
                margin: 10,
                color: "#999",
                fontSize: 16,
            },
        },
        series: [
            {
                type: "pictorialBar",
                symbol: man,
                symbolRepeat: "false",
                symbolMargin: [10, 0],
                symbolClip: true,
                symbolSize: [17, 44],
                symbolBoundingData: 1,
                data: [0],
                z: 10,
            },
            {
                type: "pictorialBar",
                label: {
                    show: false,
                },
                animationDuration: 0,
                symbolRepeat: "fixed",
                symbolMargin: [10, 0],
                symbol: man,
                symbolSize: [17, 44],
                symbolBoundingData: 1,
                data: [1],
                z: 5,
            },
        ],
    }

    constructor(option) {
        super(option);
        this.max = option.max || 1
        this.sex = option.sex === 'girl' ? girl : man
        this.defaultOption.color = option.sex === 'girl'
            ? ["#E03DA4", "#3C404C"]
            : ["#29D7A8", "#3C404C"]
        this.defaultOption.series[0].symbol = this.sex
        this.defaultOption.series[1].symbol = this.sex
        this.defaultOption.xAxis.max = this.max
        this.defaultOption.series[0].symbolBoundingData = this.max
        this.defaultOption.series[1].symbolBoundingData = this.max
        this.defaultOption.series[1].data = [this.max]
    }
    render() {
        this.defaultOption.series[0].symbol = this.sex
        this.defaultOption.series[1].symbol = this.sex
        this.defaultOption.xAxis.max = this.max
        this.defaultOption.series[0].symbolBoundingData = this.max
        this.defaultOption.series[1].symbolBoundingData = this.max
        this.defaultOption.series[1].data = [this.max]
        return super.render();
    }
}